package com.resjz.milddog.controller;


import com.purgeteam.cloud.dispose.starter.Result;
import com.resjz.milddog.service.user.UserService;
import lombok.extern.slf4j.Slf4j;

//import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
   @PostMapping(value = "/login/{id}")
   public Result userlogin(@PathVariable("id") Long id) {
       //要是用spring——auth2.0，应该是已登录完的
       return Result.ofSuccess(userService.getUserInfoByZId(id));
   }
   @PostMapping(value = "/getusermenu")
   public Result getUserMenu(Long id) {
       return userService.getusermenu(1L);
   }
   //鉴权测试
    @GetMapping(value = "/r1")
    //@PreAuthorize("hasAnyAuthority('p1')")
    public String r1(){
       return "访问资源1";
    }
}
